<?php

namespace catchAdmin\pc\tables;

use catchAdmin\pc\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class WechatUser extends CatchTable
{

    public function Table()
    {
        return $this->getTable('wechatUser')
            ->header([
//                HeaderItem::label('')->selection(),
                HeaderItem::label('用户名')->prop('name')->width('250'),
                HeaderItem::label('昵称')->prop('nickname')->width('250'),
                HeaderItem::label('手机号')->prop('phone')->width('120'),
                HeaderItem::label('头像')->prop('avatar')->width('120')->withPreviewComponent(),
                HeaderItem::label('公司类型')->prop('company_type_name')->width('120'),
                HeaderItem::label('审核状态')->prop('company_status_name')->width('120'),
                HeaderItem::label('余额')->prop('balance')->width('120'),
                HeaderItem::label('积分')->prop('ji_fen')->width('120'),
                HeaderItem::label('最后登录时间')->prop('last_login_time_show')->width('150'),
                HeaderItem::label('分享码')->prop('share_code')->width('120'),
                HeaderItem::label('操作')
                    ->actions([
//                        Actions::update(),
//                    Actions::delete(),
                        Actions::normal('查看详情', 'zz3', 'viewinfos', 'el-icon-s-tools'),

                    ]),
            ])
            ->withSearch([
                Search::label('用户名')->text('name', '用户名')->style(['width' => '150px'])->clearable(true),
                Search::label('昵称')->text('nickname', '昵称')->style(['width' => '150px'])->clearable(true),
                Search::label('手机号')->text('phone', '手机号')->style(['width' => '150px'])->clearable(true),
                Search::label('分享码')->text('share_code', '分享码')->style(['width' => '100px'])->clearable(true),
                Search::label('企业类型')->select('company_type', '选择企业类型', tableSelectArray((new \catchAdmin\model\WechatUser())->getCompanyTypeNameList()))
                    ->style(['width' => '100px'])
                    ->clearable(true),
                Search::label('审核状态')->select('company_status', '选择审核状态', tableSelectArray((new \catchAdmin\model\WechatUser())->getCompanyStatusNameList()))
                    ->style(['width' => '100px'])
                    ->clearable(true),
            ])
            ->selectionChange()
            ->withApiRoute('wechatUser')
            ->withActions([
//                Actions::create(),
//                Actions::export(),
            ])
            ->render();
    }


    public function form()
    {
        return Factory::create('wechatUser');
    }

}
